package com.twu.biblioteca;

/**
 * Created by sravanns on 12/06/14.
 */
public class Book {

    private String book_name;
    private String book_author;
    private int year_of_publishing;

    public Book(String name, String author, int year) {
        setBook_name(name);
        book_author = author;
        year_of_publishing = year;

    }

    @Override
    public String toString() {
        return "\nNAME: " + getBook_name() + " AUTHOR: " + book_author + " YEAR: " + year_of_publishing;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        Book book = (Book) o;

        if (year_of_publishing != book.year_of_publishing) return false;
        if (book_author != null ? !book_author.equals(book.book_author) : book.book_author != null) return false;
        if (getBook_name() != null ? !getBook_name().equals(book.getBook_name()) : book.getBook_name() != null) return false;

        return true;
    }

    @Override
    public int hashCode() {
        int result = getBook_name() != null ? getBook_name().hashCode() : 0;
        result = 31 * result + (book_author != null ? book_author.hashCode() : 0);
        result = 31 * result + year_of_publishing;
        return result;
    }

    public String getBook_name() {
        return book_name;
    }

    public void setBook_name(String book_name) {
        this.book_name = book_name;
    }
}

